package com.hystrix.command;

import com.hystrix.http.HttpPost;
import com.hystrix.util.Constant;
import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;

/**
 * 被动执行
 * 
 * Hot Reactive : 返回一个立即执行了Command的Observable
 * 
 * Cold Reactive ： 返回一个没有执行的Observable，只有当执行subscribe时才调用接口
 * 
 * @author wangxh
 *
 */
public class ObservableReactiveCommand extends HystrixCommand<String> {

	private String reactive;

	public ObservableReactiveCommand(String reactive) {
		super(HystrixCommandGroupKey.Factory.asKey("ObservableReactiveCommand"));
		this.reactive = reactive;
	}

	@Override
	protected String run() throws Exception {
		return HttpPost.httpPost(Constant.serviceBreactive + "?reactive=" + reactive, "", "utf-8");
	}

}
